package com.example.thymeleafdemo.controller;

import com.example.thymeleafdemo.pojo.Person;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ljw
 * @description
 * @date 2021/10/21 7:36
 */
@Controller
public class ThymeleafController {

    @RequestMapping("")
    public String index(Model model) {
        Person person = new Person("aa", 11);
        List<Person> people = new ArrayList<>();
        people.add(new Person("bb", 22));
        people.add(new Person("cc", 33));
        people.add(new Person("dd", 44));
        model.addAttribute("singlePerson", person);
        model.addAttribute("people", people);
        return "index";
    }
}
